#ifndef RENDERERWIDGET_H
#define RENDERERWIDGET_H

#include <QGLWidget>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QTime>
#include <QLineEdit>
#include <string>
#include "csgcontroller.h"

using namespace std;

class RendererWidget : public QGLWidget
{
public:

    Camera cam;
    Camera defaultCam;
    Camera axisCam;
    QTime *timer;
    QPoint lastPos;
    bool showNormals;

    //Width and height of the window
    int w,h , m_triangleType;
    bool m_showAll;

    CSGController m_csgControl;

    RendererWidget(QWidget *parent);
    ~RendererWidget();

    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void keyPressEvent(QKeyEvent *event);
    void updateAxisCam();
    void resetCam();

    void readCSGFile(QString fileName);
    long int calcIsoSurface(XYZ originPoint , int dims[3] , double spacing[3]);

    void initializeGL();
    void resizeGL( int w, int h );

    void initLightingModel();

    void paintGL();
    void drawCoordSystemReferences();
    void drawAxis(GLUquadric *quadric);
};

#endif // RENDERERWIDGET_H
